package net.mingsoft.basic.util;

import net.mingsoft.basic.biz.*;
import net.mingsoft.basic.entity.*;
import java.util.*;

public class LogUtil
{
    public static void log(final String title, final String msg, final String businessType, final String businessId) {
        final ILogBiz logBiz = SpringUtil.getBean(ILogBiz.class);
        final String className = new Exception().getStackTrace()[1].getClassName();
        final LogEntity log = new LogEntity();
        log.setLogMethod(className);
        log.setLogUrl("");
        log.setLogErrorMsg(msg);
        log.setLogResult("");
        log.setLogLocation(IpUtils.getRealAddressByIp(BasicUtil.getIp()));
        log.setLogTitle(title);
        log.setCreateDate(new Date());
        log.setLogBusinessType(businessType);
        log.setBusinessId(businessId);
        log.setLogIp(BasicUtil.getIp());
        logBiz.save(log);
    }
}
